library(plotly)
## Warning: package 'plotly' was built under R version 4.0.5
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
Cost <- matrix(c(143.61960392, 115.09864977, 109.45016606, 110.61421539,
  114.55279063, 117.02666015, 119.67376824, 122.66104692,
                      125.88805766, 140.20618041,  90.68887653,  64.71652192,  
                      55.5491608 ,  54.10068701,  57.30476225,  60.12017775,  
                      63.3853298 ,  65.2631291 , 142.97746946,  89.69272795,  
                      54.83506015,  37.82789855,32.08895171,  32.16422778,  
                      34.05488821,  37.05714102, 40.40671386, 145.00710911, 
                      92.07122501,  56.56088791,  35.02572789, 27.19868122,  
                      26.04186624,  27.59251945,  30.42014512,33.03545483,
                    147.45798821,  96.32678674,  58.86832781,  38.01720073,
                    28.82450302,  26.79135623,  28.20915909,  30.8076902 ,
                      33.64824563,151.16563287,  98.09195291,  62.84063617,  
                    41.18963894,31.82506815,  29.42231785,  30.82786215,  33.24366311,
 36.11419719,
154.07010446, 100.41527314,  65.10309034,  43.83909827,
 34.76470769,  32.60251116,  33.83435066,  36.18920464,
 39.0110037 ,
158.47615937, 105.85451056,  67.89615958,  47.01327805,
 38.11698831,  35.3647126 ,  36.77343191,  39.19228167,
 42.03907385,
160.29069387, 108.59593988,  71.82902253,  50.02421171,
 40.83104643,  38.55256231,  39.63560493,  42.19494635,
 45.0395107 ), nrow = 9)
z<-Cost

x<-matrix(c(1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9,
            1,2,3,4,5,6,7,8,9), nrow = 9)


fig <- plot_ly(z = ~Cost)
fig <- fig %>% add_surface()

fig
fig %>%
  config(
    toImageButtonOptions = list(
      format = "svg",
      filename = "myplot",
      width = 600,
      height = 700
    )
  )